/**
 * CC2003
 * 
 * For the course CC2003 - Algorithms and Data Structures of UVG (Universidad del Valle de Guatemala, http://uvg.edu.gt)
 * 
 * 
 * 
 * SVN Repository of my course projects: http://cc2003.svn.sourceforge.net/viewvc/cc2003/
 * 
 * 
 * Copyright (C) 2009 Carlos Lopez Camey
 * visit me at http://kmels.net or write me at c.lopez@kmels.net
 * 
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/> or write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package tests;


import java.io.FileInputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import esquemas.*;
import esquemas.ColeccionCampos.Campo;

import junit.framework.TestCase;

/**
 * @author kmels
 *
 */
public class alumnosUnmarshalTest extends TestCase {
	Unmarshaller unmarshaller;
		
	/* (non-Javadoc)
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		
		try {
            // create a JAXBContext capable of handling classes generated into
            // the "esquemas" package
            JAXBContext jc = JAXBContext.newInstance( "esquemas" );
            
            // create an Unmarshaller
            this.unmarshaller = jc.createUnmarshaller();
            
            
            
        } catch( JAXBException je ) {
            je.printStackTrace();
        }
	}

	public void testnormal(){
		assertTrue(true);
		
		try {
			// unmarshal a po instance document into a tree of Java content
	        // objects composed of classes from the primer.po package.
	        Instrucciones instrucciones = (Instrucciones) this.unmarshaller.unmarshal( new FileInputStream( "src/tests/ejemploAlumnos1.xml" ));
	            
	        System.out.println("instrucciones: "+instrucciones);
	        
	        // display the shipping address
	        System.out.println(instrucciones.getCreateOrIngresarOrRemover());
	        
	        Iterator iter = instrucciones.getCreateOrIngresarOrRemover().iterator();
	      
	        while (iter.hasNext()){
	        	Object proximo = iter.next();
	        	System.out.println(proximo);
	        	
	        	
	        	
	        	System.out.println(proximo.getClass());
	        	
	          System.out.println(proximo);
	        }

	        //USAddress address = po.getShipTo();
	        //displayAddress( address );
	        
	        // display the items
	        //Items items = po.getItems();
	        //displayItems( items );
        } catch( JAXBException je ) {
            je.printStackTrace();
        } catch( IOException ioe ) {
            ioe.printStackTrace();
        }
	}

}
